package com.example.shuiyin.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 移除对API路径的资源映射，因为这是动态API而不是静态资源
        // registry.addResourceHandler("/api/auth/admin/**")
        //        .addResourceLocations("classpath:/static/api/auth/admin/");
                
        // 添加其他静态资源映射
        registry.addResourceHandler("/static/**")
                .addResourceLocations("classpath:/static/");
        
        // 添加Swagger UI资源映射（如果使用）
        registry.addResourceHandler("/swagger-ui/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
        
        // 添加上传文件访问映射
        registry.addResourceHandler("/uploads/**")
                .addResourceLocations("file:uploads/");
    }
} 